<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">

    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">

    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">

    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />

    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">

    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">

    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />

    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">

    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet">

</head>

<body>

<!-- Aside Start-->
<!--{template admin_v2/leftside}-->
<!-- Aside Ends-->


<!--Main Content Start -->
<section class="content">

    <!-- Header -->
    <!--{template admin_v2/header}-->
    <!-- Header Ends -->


    <!-- Page Content Start -->
    <!-- ================== -->

    <div class="wraper container-fluid diary-topics">

        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">订阅号审核列表</h3>
                    </div>
                    <br>
                    <div class="form-inline">
                        <div class="form-group">
                            <label>
                                筛选:
                            </label>
                            <div class="form-group">
                                <select class="form-control" id="masterType" name="status">
                                    <option value="100">全部</option>
                                    <option value="0">待审核</option>
                                    <option value="1">审核通过</option>
                                    <option value="2">审核拒绝</option>
                                    <option value="3">审核拒绝且不能再次提交</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <div id="page"></div>
                            </div>
                        </div>

                        <form style="float:right;"  role="form" class="form-inline">
                            <select class="form-control" id="typeName" name="typeName">
                                <option value="uid">用户id</option>
                                <option value="operator_name">运营人员姓名</option>
                                <option value="operator_mobile">联系电话</option>
                                <option value="company_name">公司名称</option>
                            </select>
                            <div class="form-group">
                                <input type="text" name="typeValue" id="typeValue" class="form-control">
                            </div>
                            <button class="btn btn-success m-l-10" id="searchList" type="button">查看</button>
                        </form>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-md-12 col-sm-12 col-xs-12">
                                <table id="datatable" class="table table-striped table-bordered">
                                    <thead>
                                    <tr>
                                        <th style="width: 4%;">UID</th>
                                        <th style="width: 4%;">昵称</th>
                                        <th style="width: 4%;">类别</th>
                                        <th style="width: 5%;">申请时间</th>
                                        <th style="width: 15%;">运营人员信息</th>
                                        <th style="width: 5%;">运营人员身份证</th>
                                        <th style="width: 15%;">公司/机构信息</th>
                                        <th style="width: 10%;">组织机构代码证/营业执照</th>
                                        <th style="width: 10%;">个人辅助证明材料</th>
                                        <th style="width: 10%">其他图片材料</th>
                                        <th style="width: 4%">状态</th>
                                        <th style="width: 8%;">操作</th>
                                    </tr>
                                    </thead>

                                    <tbody id="viewList">

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- Page Content Ends -->
    <!-- ================== -->

    <div id="con-close-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">

    </div><!-- /.modal -->


    <!-- Footer Start -->
    <!--{template admin_v2/footer}-->
    <!-- Footer Ends -->



</section>
<!-- Main Content Ends -->


<!-- js placed at the end of the document so the pages load faster -->
<script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
<script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
<script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

<script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>
<script src="<!--{eval echo register_static('laytpl/laytpl.js');}-->"></script>
<script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>
<script src="<!--{eval echo register_static('laydate/laydate.js');}-->"></script>
<script src="<!--{eval echo register_static('laypage/laypage.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

<!-- Modal-Effect -->
<script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
<script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>
<script src="<!--{eval echo register_static('js/common.js');}-->"></script>
<script id="list" type="text/html">
    {{# for(var i=0,len=d.length;i< len;i++){ }}
    <tr>
        <td><a target="_blank" href="http://ffweb.ffrj.net/profile.php?ac=index&id={{d[i].uid}}">{{d[i].uid}}</a></td>
        <td><a target="_blank" href="admin.php?ac=admin&do=accountOperation&uid={{d[i].uid}}">{{d[i].user.nickname}}</a></td>
        <td>{{laytpl.typeInfo(d[i].type)}}</td>
        <td>{{laytpl.dateTime(d[i].created_at)}}</td>
        <td>
            姓名：{{d[i].operator_name}}
            <br />
            电话：{{d[i].operator_mobile}}
            <br />
            邮件：{{d[i].email}}
            <br />
            身份证号：{{d[i].operator_id}}
        </td>
        <td>
            <img src="https://img.fenfenriji.com{{d[i].operator_url}}" class="showImg" style="max-width: 100px; max-height: 100px" />
        </td>
        <td>
            名称：{{d[i].company_name}}
            <br />
            机构代码/社会信用码：{{d[i].organization_code}}
            <br />
            官网/应用名称：{{d[i].company_info}}
        </td>
        <td>
            <img src="{{d[i].organization_url}}" class="showImg" style="max-width: 100px; max-height: 100px" />
            <img src="{{d[i].business_license_url}}" class="showImg" style="max-width: 100px; max-height: 100px" />
        </td>
        <td>{{d[i].illustrate}}</td>
        <td>{{laytpl.loopAttachment(d[i].extend)}}</td>
        <td>{{laytpl.statusInfo(d[i].status, d[i].reason)}}</td>
        <td>
            <div class="btn-group">
                <button type="button" class="btn btn-info">管理</button>
                <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <span class="caret"></span>
                    <span class="sr-only">Toggle Dropdown</span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="javascript:void(0);" class="verifiedPass" data-status="1" data-oldstatus="{{d[i].status}}" data-id="{{d[i].id}}" data-uid="{{d[i].uid}}">审核通过</a></li>
                    <li><a href="javascript:void(0);" class="verifiedStop" data-status="2" data-oldstatus="{{d[i].status}}" data-id="{{d[i].id}}" data-uid="{{d[i].uid}}">审核拒绝</a></li>
                </ul>
            </div>
        </td>
    </tr>
    {{# } }}
</script>
<script id="vertpl" type="text/html">
    <form  role="form" class="form-inline">
        <div class="form-group">
            <textarea name="reason" class="reason" id="reason" style="width: 320px; height: 100px">请输入拒绝原因</textarea>

            <input type="hidden" name="uid" id="uid">
            <input type="hidden" name="id" id="id">
        </div>
        <button class="btn btn-success stop"  type="button">提交</button>
        <div><input name="stop" id="stopBox" type="checkbox"/>不允许再次提交</div>
    </form>
</script>
<script type="text/javascript">
    var start = 0;
    var length = 20;
    var status = 0;
    var typeName = '';
    var typeValue = '';

    var params = function(){
        if(status == 100){
            return {start:start,length:length,typeName:typeName,typeValue:typeValue,action:'getVerifiedCheckList',do:'masterAuth'};
        }
        return {status:status,start:start,length:length,typeName:typeName,typeValue:typeValue,action:'getVerifiedCheckList',do:'masterAuth'};
    }

    var displayRes = function(data){
        laytpl($('#list').html()).render(data,function(html){
            $('#viewList').html(html);
        });
    }

    $(document).on('click','.verifiedStop',function () {
        var oldStatus = $(this).data('oldstatus');
        if(oldStatus !== 0 && oldStatus !== 3) {
            alert('已审核信息不能再次更改状态');
        }else {
            var id = $(this).data('id');
            var uid = $(this).data('uid');
            laytpl($('#vertpl').html()).render({}, function (html) {
                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['420px', '240px'], //宽高
                    content: html
                });
            })
            $('#id').val(id);
            $('#uid').val(uid);
        }
    });

    $(document).on('click','.stop',function(){
        var data={};
        data['id'] = $('#id').val();
        data['uid'] = $('#uid').val();
        data['status'] = 2;
        data['reason'] = $('#reason').val();
        if(data['reason'] == '请输入拒绝原因'){
            alert('请输入拒绝原因');
            return false;
        }
        data['action'] = 'setVerifiedInfo';
        data['do'] = 'masterAuth';
        if($('#stopBox').is(':checked')){
            data['status'] = 3;
        }

        request(data, resDisplay);
    });

    $(document).on('click','.verifiedPass',function(){
        var oldStatus = $(this).data('oldstatus');
        if(oldStatus !== 0) {
            alert('已审核信息不能再次更改状态');
        }else {
            var data = {};
            data['id'] = $(this).data('id');
            data['uid'] = $(this).data('uid');
            data['status'] = $(this).data('status');
            data['action'] = 'setVerifiedInfo';
            data['do'] = 'masterAuth';
            request(data, resDisplay);
        }
    });


    $(document).on('click','#verifiedlist',function () {
        uid = 0;
        verified = 2;
        request(params(), displayRes);
    });

    $(document).on('click','#searchList',function () {
        typeName = $('#typeName').val();
        typeValue = $('#typeValue').val();
        request(params(), displayRes);
    });

    $(document).on('focus', '.reason' ,function () {
        var value =  $(this).val();
        if( value == '请输入拒绝原因'){
            $(this).val('');
        }
    });

    $(document).on('blur', '.reason' ,function () {
        var value =  $(this).val();
        if( value == ''){
            $(this).val('请输入拒绝原因');
        }
    });

    $(document).on('change','#masterType',function () {
        uid = 0;
        status=$(this).val()
        request(params(), displayRes);
    });

    $(document).on('click','#checkUid',function () {
        uid = $('#uid').val();
        request(params(), displayRes);
    })
    laypage({
        cont: document.getElementById('page'), //容器。值支持id名、原生dom对象，jquery对象,
        pages: 800, //总页数
        skin: 'molv', //加载内置皮肤，也可以直接赋值16进制颜色值，如:#c00
        groups: 8, //连续显示分页数
        jump:function(obj){
            var page = obj.curr;
            start = (page-1)*length;
            request(params(), displayRes);
        }
    });

//    $(function(){
//        request(params(), displayRes);
//    });
//

    laytpl.dateTime= function (time) {
        if(!!time){
            return new Date(parseInt(time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
        }
        return '无';
    }
    laytpl.loopAttachment = function (extend) {
        var attachment = extend.attachment;
        var html = '';
        if(attachment != undefined) {
            for (var i = 0; i < attachment.length; i++) {
//            html += '<img style="width: 383px;height: 858px" src="'+$(this).attr('src')+'" />';
                if (attachment[i].path != undefined){
                    html += '<img src="https://img.fenfenriji.com' + attachment[i].path + '" class="showImg" style="max-width: 100px; max-height: 100px" />';
                }
            }
        }
        return html;
    }

    laytpl.status = function(v){
        var s = '审核中';
        switch(v){
            case '0':
                s = '审核中';
                break;
            case '1':
                s = '审核通过';
                break;
            case '2':
                s = '审核拒绝';
                break;
            case '3':
                s = '审核拒绝且不允许再次提交';
        }
        return s;
    }
    laytpl.statusInfo = function(status, reason){
        var statusInfo = '审核中';
        switch(status){
            case '0':
                statusInfo = '审核中';
                break;
            case '1':
                statusInfo = '审核通过';
                break;
            case '2':
                statusInfo = '审核拒绝(' + reason + ')' ;
                break;
            case '3':
                statusInfo = '审核拒绝且不允许再次提交(' + reason + ')' ;
                break;
        }
        return statusInfo;
    }
    laytpl.typeInfo = function (v) {
        var t = '错误类型';
        switch(v){
            case '1':
                t = '个人';
                break;
            case '2':
                t = '公司';
                break;
        }
        return t;
    }
    $(document).off('mouseenter', '.showImg').on('mouseenter', '.showImg', function () {
        layer.tips('<img style="width: 383px;height: 858px" src="'+$(this).attr('src')+'" />', $(this), {
            tips: [2, '#fff'],
        });
    });
</script>
</body>
</html>
